Skip to content

Add adaptive widescreen with left-aligned city HUD and centered menus - #1

Merged
blackerking merged 24 commits into
mainfrom
codex/simcity-adaptive-renderer
Sep 23, 2026
Merged

blackerking merged 24 commits into
mainfrom
codex/simcity-adaptive-renderer

Conversation

@mstan

@mstan mstan commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Adds an opt-in Adaptive Widescreen mod that reveals more city columns or rows as the window changes shape. The city toolbar and status display default to the top left; the title, standalone menus and advisor/tutorial pages stay centered. Centered gameplay remains available. Settings persist through the shared Mods launcher, and F11 toggles fullscreen.

Integrates current UrbanRecomp main (28c280b) and addresses the renderer regressions reported in #2. Main's published engine pin (bc2838d), beam/audio fixes, translations, SRAM persistence and optional launcher behavior are retained. Sylt and Adaptive Widescreen share the launcher.

  • Fixes title lights/fades, scenario cards, fax wood, roof graphics/overlap, fine scrolling and staging-edge seams, moving OAM sprites and their priority, statistics/tax margins, and city-load fades. Each regression fix has its own commit.
  • Probes the actual OpenGL version and falls back to gameplay when the launcher cannot run; also supports builds without the optional launcher dependency.
  • Separates advisor page/portrait pixels from the dimmed city background, including transparent black lettering backed by the original clipping window. Centering the page leaves the city/HUD in place and removes the old panel's black hole.
  • Preserves native pixels except the bare eight-pixel city staging columns and the background exposed by moving an advisor page. The custom renderer reads live game/PPU data without writing guest memory or replaying the PPU. It extends game-emitted moving sprites; it does not invent offscreen actors.

Validation on Windows/SDL3: Release build and both CTests pass. The renderer suite passes 16 comparisons with 13,920 paired CPU/WRAM/clock checks, 142 native-region captures and a separate 300-frame save/restore comparison. The new wide/portrait layout suite adds 7,200 paired state checks and 48 captures, including eight advisor captures checked against original page pixels and an independent stock-PPU background reference with obsolete occlusion removed. City and advisor states both pass six actual window-resize shapes. The preceding regression work also validated launcher toggle/choice/Play/persistence, no-OpenGL fallback and a build without the launcher.

Custom city reconstruction is qualified for the USA ROM. AOT, other regions and every translated/disaster scene are not covered by this validation. Interactions retain the original game's coordinates; pan to interact with city space first seen in a margin.

Renderer behavior, fixes and reproducible checks · Screenshot gallery

Centered title:

Centered title

Centered advisor over the stationary city:

Centered advisor

Left-aligned gameplay controls:

Left-aligned city HUD

@mstan
mstan requested a review from blackerking September 14, 2026 05:32
blackerking added a commit that referenced this pull request Sep 17, 2026
Launcher (src/sc_launcher.c, recomp-ui submodule at cb7e54b):
- Started without a ROM argument, the game shows recomp-ui's launcher:
  ROM, window, fullscreen, filter, audio, widescreen, language
  (English/Deutsch/Francais), the Sylt scenario as a mod, and keyboard
  bindings. Choices go to sc-settings.ini, bindings to keybinds.ini.
- Runs other than --qualify apply sc-settings.ini as SC_WIDESCREEN,
  SC_NINTH, SC_TRANSLATION and SC_PACKET_PATCH where these are not set by
  hand; --launcher shows the launcher, --no-settings ignores the file.
- The pad reads keybinds.ini; a first run writes this host's own layout.
- The launcher needs OpenGL 3.3 and recomp-ui does not check for it. The
  host asks the context for its version first and starts the game directly
  where there is none (a Hyper-V VM reports GDI Generic 1.1).

Save states (from #1):
- States carry the PPU's CPU-port latches, the host master clock and the
  HDMA walker behind a versioned header; the missing latches broke uploads
  after loading a state taken mid-upload (report and loan screens). A
  save/restore matched the uninterrupted run for 300 frames and 12
  pictures. Old states still load, with a warning.
- --qualify gains SC_SAVE_AT/SC_SAVE_PATH and SC_STATE_TRACE.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mstan mstan changed the title Add adaptive widescreen renderer mod and shared Mods launcher Add adaptive widescreen with left-aligned city HUD and centered menus Sep 19, 2026
blackerking and others added 4 commits September 22, 2026 16:01
Brings in the German bank page, the vehicles kept for the margin, the
selector's pins and win marks, ALL SCENARIO WON, and the two shared modules
the adaptive renderer uses next: src/sc_vehicles.c (ScVehicles_Shown) and
src/sc_selector.c.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ive renderer

The margins showed neither: the game drops its vehicles once they are right
of its 256 columns, and the selector's margin pins and marks cannot be told
from the blink-hidden bracket by raw OAM X, with Sylt's not in OAM at all.

- object_row draws the vehicles src/sc_vehicles.c keeps (ScVehicles_Shown,
  handed in by the host each frame as r->vehicles), before the OAM's own
  sprites, at the size c019 gives them -- their parked slots' size bit is
  the park's, hence sprite_word_pixel() with the size as a parameter.
- scenery draws src/sc_selector.c's pins and marks, the game's and Sylt's
  (r->sylt), outside the core on the selector's screens -- $0A included once
  its map is in VRAM, so the fade-in from the fax or the menu shows the
  whole selector and not the shipped map.

Rows follow the PPU (row 0 on line Y), as the core's half of an object
crossing the edge does. sc_renderer_test links sc_selector.c; both
renderer tests pass. Checked at 32:9: the ship panned across the margin,
the pins at scroll $00, and the fade from the fax with Sylt won.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- Title lights stretched, squeezed and seemed to run backwards in the
  margins. find_lights started from lo = 256 and counted each member's
  distance to it as a gap, so the first member visited set the pitch to
  256 - x (20 px for a light at 236), changing every frame as the row
  moved. The pitch is now the smallest gap between sorted neighbours, and
  each row is evaluated once.
- Margin sprites sat one row above the core's half of the same object --
  the train at the seam. The PPU evaluates a line's sprites one line early,
  so a sprite's row 0 is on line Y, not Y-1: object_row and the title
  lights use y - Y. The train at the seam now matches the native picture
  pixel for pixel. The two renderer tests that encoded y+1 move to the
  PPU's row.
- Selector to fax: the margins stayed black for the fax's whole fade-in and
  then popped in, because $0C (and $0B) were taken for the selector even
  after the fax's desk had arrived. The map on screen decides now (BG1 at
  $3000 in mode 0); the margins fade with the centre.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A fresh install starts with it enabled at 21:9, a 448x224 canvas as wide as
the classic widescreen, so the margins are there whatever the window's
shape. Switching it off in Mods, or Enabled=0 in sc-video.ini, returns to
the classic widescreen; a saved choice is kept either way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@blackerking
blackerking marked this pull request as ready for review September 23, 2026 06:27
@blackerking
blackerking merged commit 58d0b30 into main Sep 23, 2026
@blackerking

Copy link
Copy Markdown
Owner

Merged into main today, and the adaptive renderer is the default from v1.1.0 on: 21:9 out of the box, --aspect 32:9 for the wider monitors, and the classic widescreen stays as the fallback (launcher → Widescreen → Enabled, or --video-config). Thank you -- it is a much better answer than widening the console's own picture, and the release notes say so.

What landed on top of your branch before and after the merge, so you know what changed under your code:

  • Vehicles in the margin (checklist item 7). src/sc_vehicles.c keeps the ship, the plane, the helicopter and the train alive after 00:c019 drops them 32 cells past the view, and follows both scroll paths (01:f11a with A held, 01:ef29/01:ef86 on the cursor edge). Your renderer draws them in object_row through r->vehicles, so no globals reach into it. 06fcbf0, 0bc98ee, 2386192.
  • The selector's pins and win marks, Sylt's included, from src/sc_selector.c -- one expander of the game's sprite-text records (COP 2, 00:8ea9) that both renderers read. 82f921b, 06fcbf0.
  • The title sign (item 14), now src/sc_titlesign.c: it reads the animation channel instead of OAM, so the board crosses the whole margin with its lettering blinking and leaves at the true edge. 442c702.
  • Four faults reported from play, all in the adaptive path (3a76afd, 2386192):
    • the title's light row was dragged and squeezed while it moved -- find_lights measured the pitch from a sentinel of 256;
    • the wooden background arrived late on the scenario → fax fade;
    • the rail was not pixel-exact at the seam;
    • the rail jittered when scrolling left with the cursor.
  • Both of your renderer tests now use the PPU's row convention. ppu_evaluateSprites(ppu, line - 1) means a sprite's row 0 lands on buffer row Y, not Y - 1; object_row used y + 1. Fixed in the renderer and in the two expectations.

Checklist item 15 went the other way round, and the issue's premise was wrong. It said the billboard's one-frame lag behind the building is the game's own behaviour and stays, so the margin copy should reproduce it. Measured frame by frame in the native columns, that lag is exactly what makes the board shiver:

its building   -1 +0 -1 +0 -1 +0 -1 +0 ...
the billboard  +0 -1 +0 -1 +0 -1 +0 -1 ...

05:942e runs the animation channel first (the COP at 05:9448, which writes the six sprites into the shadow OAM) and steps the scene after it -- INC $16 for the skyline's scroll and DEC $0277 for the sign, in one breath at 05:9460. Both reach the PPU at the next NMI, the sprites from before that pair and the scroll from after it. With the pan moving a pixel every second frame the two never step together, so the board shivers a pixel against the tower for the whole crossing, on hardware too. title_sign_align() now puts those six entries on the frame their scroll belongs to, once per frame before anything reads OAM; both renderers get it since both scan the same OAM, and the margins draw from the same position, so the halves meet exactly at the seam. Only the sign's 48x32 changes (620 px on the stepping frames, nothing on the others). SC_SIGN_ALIGN=0 restores the lag if you want the hardware behaviour.

Still open from the checklist, and both belong to the renderer -- measured again today on main, savestate at the selector, 448 px wide:

  • Item 12, the card pictures in the margin columns. The core card's dark pixels are #000000, the right-margin card's are #522910 and #391008 -- the desk's wood showing through. Colour 0 of the card art is still treated as transparent out there.
  • Item 13, the margin cards appearing at full brightness on the first settled frame instead of fading in with the others.

Release: https://github.com/blackerking/UrbanRecomp/releases/tag/v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants